<?php
/**
 * @copyright	Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
 * @license		GNU/GPL, see LICENSE.php
 * Joomla! is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

include_once (dirname(__FILE__).DS.'/ja_vars.php');

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>">

<head>
<jdoc:include type="head" />
<?php JHTML::_('behavior.mootools'); ?>

<link rel="stylesheet" href="<?php echo $tmpTools->baseurl(); ?>templates/system/css/system.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $tmpTools->baseurl(); ?>templates/system/css/general.css" type="text/css" />
<link rel="stylesheet" href="<?php echo $tmpTools->templateurl(); ?>/css/template.css" type="text/css" />

<script language="javascript" type="text/javascript" src="<?php echo $tmpTools->templateurl(); ?>/js/ja.script.js"></script>

<?php if ($tmpTools->getParam('rightCollapsible')): ?>
<script language="javascript" type="text/javascript">
var rightCollapseDefault='<?php echo $tmpTools->getParam('rightCollapseDefault'); ?>';
var excludeModules='<?php echo $tmpTools->getParam('excludeModules'); ?>';
</script>
<script language="javascript" type="text/javascript" src="<?php echo $tmpTools->templateurl(); ?>/js/ja.rightcol.js"></script>
<?php endif; ?>

<?php  if($this->direction == 'rtl') : ?>
<link rel="stylesheet" href="<?php echo $tmpTools->templateurl(); ?>/css/template_rtl.css" type="text/css" />
<?php else : ?>
<link rel="stylesheet" href="<?php echo $tmpTools->templateurl(); ?>/css/menu.css" type="text/css" />
<?php endif; ?>

<?php if ($this->countModules('hornav')): ?>
<?php if ($tmpTools->getParam('horNavType') == 'css'): ?>
<link rel="stylesheet" href="<?php echo $tmpTools->templateurl(); ?>/css/ja-sosdmenu.css" type="text/css" />
<script language="javascript" type="text/javascript" src="<?php echo $tmpTools->templateurl(); ?>/js/ja.cssmenu.js"></script>
<?php else: ?>
<link rel="stylesheet" href="<?php echo $tmpTools->templateurl(); ?>/css/ja-sosdmenu.css" type="text/css" />
<script language="javascript" type="text/javascript" src="<?php echo $tmpTools->templateurl(); ?>/js/ja.moomenu.js"></script>
<?php endif; ?>
<?php endif; ?>

<?php if ($tmpTools->getParam('theme_header') && $tmpTools->getParam('theme_header')!='-1') : ?>
<link rel="stylesheet" href="<?php echo $tmpTools->templateurl(); ?>/styles/header/<?php echo $tmpTools->getParam('theme_header'); ?>/style.css" type="text/css" />
<?php endif; ?>
<?php if ($tmpTools->getParam('theme_background') && $tmpTools->getParam('theme_background')!='-1') : ?>
<link rel="stylesheet" href="<?php echo $tmpTools->templateurl(); ?>/styles/background/<?php echo $tmpTools->getParam('theme_background'); ?>/style.css" type="text/css" />
<?php endif; ?>
<?php if ($tmpTools->getParam('theme_elements') && $tmpTools->getParam('theme_elements')!='-1') : ?>
<link rel="stylesheet" href="<?php echo $tmpTools->templateurl(); ?>/styles/elements/<?php echo $tmpTools->getParam('theme_elements'); ?>/style.css" type="text/css" />
<?php endif; ?>

<!--[if IE 7.0]>
<style type="text/css">
.clearfix {display: inline-block;}
</style>
<![endif]-->
<?php if ($tmpTools->isIE6()): ?>
<!--[if lte IE 6]>
<script type="text/javascript">
var siteurl = '<?php echo $tmpTools->baseurl();?>';

window.addEvent ('load', makeTransBG);
function makeTransBG() {
	fixIEPNG($E('.ja-headermask'), '', '', 1);
	fixIEPNG($E('h1.logo a'));
	fixIEPNG($$('img'));
	fixIEPNG ($$('#ja-mainnav ul.menu li ul'), '', 'scale', 0, 2);
}
</script>
<style type="text/css">
.ja-headermask, h1.logo a, #ja-cssmenu li ul { background-position: -1000px; }
#ja-cssmenu li ul li, #ja-cssmenu li a { background:transparent url(<?php echo $tmpTools->templateurl(); ?>/images/blank.png) no-repeat right;}
.clearfix {height: 1%;}
</style>
<![endif]-->
<?php endif; ?>

<style type="text/css">
#ja-header,#ja-mainnav,#ja-container,#ja-botsl{width: <?php echo $tmpWidth; ?>;margin: 0 auto;}
#ja-footer
{
    width: 971px;
    margin: 0 auto;
}
#ja-container {margin: 10px auto;}
#ja-mainnav {width: 370px;margin: 0 auto;}  
#ja-wrapper {min-width: <?php echo $tmpWrapMin; ?>;}
</style>
<script language="javascript">
function importexcel() {
    var obj = new Object();
    
    obj.processImport = function() {
        if ($('fUploadFile').value == '') {
            alert('You must select a excel file before import.');
            return;
        }
        
        var cf = confirm("Are you sure you want to import this data ?");
        if (!cf) {
            return;
        }
        
        document.forms['frmImportExcel'].action = '<?php echo JURI::root()?>libraries/phpExcelReader/importdata.php';
        document.forms['frmImportExcel'].target = 'ifrm_upload_target';
        document.forms['frmImportExcel'].submit();
    }
    
    obj.processExport = function() {
        $vendor_id = '<?php echo JRequest::getInt('vendor_id'); ?>';
        var url = 'exportdata.php?key='+Math.random()+'&typeexport=checkdata&vendor_id='+$vendor_id;
         
        new Ajax(url, {
                    method: 'get',
                    onComplete: function(res){
                        var row = parseInt(res);
                        if (row > 0) {
                            window.location.href = 'exportdata.php?key='+Math.random()+'&vendor_id='+$vendor_id;
                        } else {
                            var cf = confirm("Do you want export sample data?");
                            if (!cf) {
                                return;
                            }
                            
                            window.location.href = 'exportdata.php?key='+Math.random()+'&vendor_id='+$vendor_id;
                        }
                    }
                }).request(); 
    }
    
    obj.checkClearData = function(chk) {
        if (chk) {
            $('btnClearData').disabled = ''; 
            $('btnClearData').addClass('button'); 
        } else {
            $('btnClearData').disabled = 'disabled';
            $('btnClearData').removeClass('button'); 
        }
    }
    
    obj.processClear = function() {
        var cf = confirm("Are you sure you want to clear this data ?");
        if (!cf) {
            return;
        }
       
        $vendor_id = '<?php echo JRequest::getInt('vendor_id'); ?>';
        var url = 'exportdata.php?key='+Math.random()+'&typeexport=cleardata&vendor_id='+$vendor_id;
        new Ajax(url, {
                    method: 'get',
                    onComplete: function(res){
                        alert("The clear data was finished successfully.");
                        window.location.href = window.location.href;
                    }
                }).request();
    } 
    
    obj.uploadDone = function() {
        var file_name = frames['ifrm_upload_target'].document.getElementsByTagName("body")[0].innerHTML;                                                                                       
        var url = 'index.php?option=com_virtuemart&page=shop.importdata&vendor_id=<?php echo JRequest::getInt('vendor_id'); ?>&fname='+file_name;
 
        new Ajax(url, {
                    method: 'get',
                    onComplete: function(res){
                        alert("The import was finished successfully.");
                        window.location.href = window.location.href;
                    }
                }).request();
    }
    
    return obj;
}

var _importexcel_ = new importexcel();
</script>
</head>

<body id="bd" class="fs<?php echo $tmpTools->getParam(JA_TOOL_FONT);?> <?php echo $tmpTools->browser();?>" onclick="gfPop.fCloseCalendarCtrl();">
<iframe width="168px" height="190px" name="gToday:normal:agenda.js" id="gToday:normal:agenda.js" src="libraries/calendar/ipopeng.htm" scrolling="no" frameborder="0" style="border:2px ridge; visibility:visible; z-index:999; position:absolute; left:-500px; top:0px;"></iframe>
<div id="ja-wrapper">
<div id="ja-wrapper-top"></div>

<!-- BEGIN: MAIN NAVIGATION -->
<?php if ($this->countModules('hornav')): ?>
<div id="ja-mainnavwrap">
    <div id="ja-mainnav" class="clearfix">
    <jdoc:include type="modules" name="hornav" />
    </div>
</div>
<?php endif; ?>
<!-- END: MAIN NAVIGATION -->

<!-- BEGIN: HEADER -->
<div id="ja-headerwrap">
	<div id="ja-header" class="clearfix">
     <?php if($this->countModules('toplogin')) : ?>
     <div style="height: 20px;text-align: right;position: absolute;top:-40px;right:30px;float: right;"> 
        <jdoc:include type="modules" name="toplogin" />
     </div>      
     <?php endif; ?>
	 <?php if($this->countModules('user4')) : ?>
     <div style="height: auto;"> 
        <jdoc:include type="modules" name="user4" />
     </div>      
     <?php endif; ?>
     <?php if($this->countModules('user7')) : ?>
     <div style="height: 90px;">
        <jdoc:include type="modules" name="user7" />
     </div>
     <?php endif; ?>
    
	</div>
</div>
<!-- END: HEADER -->


<div id="ja-containerwrap<?php echo $divid; ?>">
<div id="ja-containerwrap2">       
	<div id="ja-container">
    <?php if($this->countModules('user8')) : ?>
     <div style="height: 125px;background: url(<?php echo $tmpTools->templateurl(); ?>/images/login_bg.png) no-repeat top center;">
        <jdoc:include type="modules" name="user8" />
     </div>
     <?php endif; ?>
      
	 <div id="ja-container2" class="clearfix">
        <?php if((JRequest::getInt("page", 0)=='shop.browse')&&(JRequest::getInt("Itemid", 0)=='11')&&(JFactory::getUser()->usertype=='Author')) : ?>
         <div style="height: 90px;padding-bottom: 5px;width: 100%;text-align: left;background: url(<?php echo $tmpTools->templateurl(); ?>/images/bg_line.png) no-repeat scroll center bottom transparent;">
            <iframe id="ifrm_upload_target" name="ifrm_upload_target" src="about:blank" style="display: none;"></iframe>
            <form id="frmImportExcel" name="frmImportExcel" enctype="multipart/form-data" action="<?php echo JURI::root()?>" method="post">
                <label style="font-size: 14px;">Upload/Download Menu:</label>                
                <input style="padding: 0;height: 25px;" type="file" size="32" id="fUploadFile" name="fUploadFile" />
                <input class="button" style="padding: 0 1px 0 1px;height: 25px;" type="button" value="UPLOAD MENU" title="UPLOAD MENU" onclick="_importexcel_.processImport();" />
                <input class="button" style="padding: 0 1px 0 1px;height: 25px;" type="button" value="DOWNLOAD MENU" title="Export Data" onclick="_importexcel_.processExport();" />
                
                <label for="chkClearData">Check Here To Enable Clear Data Button</label>
                <input type="checkbox" id="chkClearData" name="chkClearData" onclick="_importexcel_.checkClearData(this.checked);"/>
                <input class="" style="padding: 0 1px 0 1px;height: 25px;" disabled="disabled" type="button" id="btnClearData" name="btnClearData" value="CLEAR MENU" title="Clear Data" onclick="_importexcel_.processClear();" />
            </form>
        <div style="text-align: center;margin-top: 5px;">(Open Template) - <a href="images/stories/menuhelp.xlsx">click here</a> to download HELP file</div>
        </div>         
        <?php endif; ?>
		<div id="ja-mainbody<?php echo $divid; ?>" class="clearfix">
          
        <?php if($this->countModules('user15')) : ?>        
        <div style="width: 98%;">
            <jdoc:include type="modules" name="user15" style="xhtml" />
        </div>
        <?php endif; ?>
		<!-- BEGIN: CONTENT -->
		<div id="ja-contentwrap">
		<div id="ja-content">

			<jdoc:include type="message" />

			<?php if(!$tmpTools->isFrontPage()) : ?>
			<div id="ja-pathway">
				<jdoc:include type="module" name="breadcrumbs" />
			</div>
			<?php endif ; ?>

			<jdoc:include type="component" />
			<?php if($this->countModules('banner')) : ?>
			<div id="ja-banner">
				<jdoc:include type="modules" name="banner" />
			</div>
			<?php endif; ?>

		</div>
		</div>
		<!-- END: CONTENT -->

		<?php if ($this->countModules('left')): ?>
		<!-- BEGIN: LEFT COLUMN -->
		<div id="ja-col1">
			<jdoc:include type="modules" name="left" style="xhtml" />
		</div><br />
		<!-- END: LEFT COLUMN -->
		<?php endif; ?>

		</div>

		<?php if ($this->countModules('right')&&JRequest::getVar('page')!='account.orders'&&JRequest::getVar('page')!='shop.browse'){ ?>
        
		<!-- BEGIN: RIGHT COLUMN -->
		<div id="ja-col2">            
			<jdoc:include type="modules" name="right" style="jarounded" />
		</div><br />
		<!-- END: RIGHT COLUMN -->
        <?php }else if ($this->countModules('right-ad')&&JRequest::getVar('page')=='shop.browse'&&(JFactory::getUser()->usertype=='Author')){ ?>
		 <div id="ja-col2">            
            <jdoc:include type="modules" name="right-ad" style="jarounded" />
        </div><br />
        <?php }?>
	</div>
    
     <?php if($this->countModules('user9')) : ?>
     <div style="margin-top: 10px;height: 218px;background: url(<?php echo $tmpTools->templateurl(); ?>/images/banner_ads_bg.png) no-repeat top center;">
        <jdoc:include type="modules" name="user9" />
     </div>
     <?php endif; ?>
	</div>
</div>
</div>

<?php
$spotlight = array ('user1','user2','top','user5');
$botsl = $tmpTools->calSpotlight ($spotlight,99,22);
if( $botsl ) :
?>
<!-- BEGIN: BOTTOM SPOTLIGHT -->
<div id="ja-botslwrap">
	<div id="ja-botsl" class="clearfix">

	  <?php if( $this->countModules('user1') ): ?>
	  <div class="ja-box<?php echo $botsl['user1']['class']; ?>" style="width: <?php echo $botsl['user1']['width']; ?>;">
			<jdoc:include type="modules" name="user1" style="xhtml" />
	  </div>
	  <?php endif; ?>

	  <?php if( $this->countModules('user2') ): ?>
	  <div class="ja-box<?php echo $botsl['user2']['class']; ?>" style="width: <?php echo $botsl['user2']['width']; ?>;">
			<jdoc:include type="modules" name="user2" style="xhtml" />
	  </div>
	  <?php endif; ?>

	  <?php if( $this->countModules('top') ): ?>
	  <div class="ja-box<?php echo $botsl['top']['class']; ?>" style="width: <?php echo $botsl['top']['width']; ?>;">
			<jdoc:include type="modules" name="top" style="xhtml" />
	  </div>
	  <?php endif; ?>

	  <?php if( $this->countModules('user5') ): ?>
	  <div class="ja-box<?php echo $botsl['user5']['class']; ?>" style="width: <?php echo $botsl['user5']['width']; ?>;">
			<jdoc:include type="modules" name="user5" style="xhtml" />
	  </div>
	  <?php endif; ?>

	</div>
</div>
<!-- END: BOTTOM SPOTLIGHT -->
<?php endif; ?>

<!-- BEGIN: FOOTER -->
<div id="ja-footerwrap">
    <div id="ja-footer" class="clearfix">
        <table width="800px" align="center">
        <tr>
        <td rowspan="2" width="25%" valign="top">
         <?php if($this->countModules('user10')) : ?>
            <div style="float: left;">
                <jdoc:include type="modules" name="user10"  style="xhtml"/>
            </div>
        <?php endif; ?>
        </td>
        <td valign="top" width="25%">
        <?php if($this->countModules('user11')) : ?>
            <div style="float: left;">
                <jdoc:include type="modules" name="user11" style="xhtml"/>
            </div>
        <?php endif; ?>
        </td>
        <td rowspan="2" width="50%" valign="top">
         <?php if($this->countModules('user13')) : ?>
            <div style="float: right;text-align: left;">
                <jdoc:include type="modules" name="user13" style="xhtml"/>
            </div>
        <?php endif; ?>
        </td>
        </tr>
        <tr>
        <td valign="top">
         <?php if($this->countModules('user12')) : ?>
            <div style="float: left;">
                <jdoc:include type="modules" name="user12" style="xhtml"/>
            </div>
        <?php endif; ?>
        </td>
        </tr>
        </table>
       
        <?php if($this->countModules('syndicate')) : ?>   
        <div style="width: 100%;margin: 0 0 20px 0;text-align: center;">
        <table width="800px" align="center">
            <tr>
                <td>
                     <jdoc:include type="modules" name="syndicate" />
                </td>
            </tr>
        </table>
        </div>
        <?php endif; ?>  
        
	    <div id="ja-footnav">
		<jdoc:include type="modules" name="user3" />
	    </div>

	    <div style="margin-bottom: 20px;">
		<jdoc:include type="modules" name="footer" />
	    </div>

	    
    </div>
</div>
<!-- END: FOOTER -->
<div id="ja-wrapper-bot"></div> 
</div>

<jdoc:include type="modules" name="debug" />

</body>

</html>
